Repository navigation
Disconnect the data flow scene from the model when the scene is deleted - #560
Open
paceholder wants to merge 2 commits into
Open
paceholder wants to merge 2 commits into
paceholder wants to merge 2 commits into
Conversation
The scene connected a lambda to DataFlowGraphModel::inPortDataWasSet without a context object. Qt cannot disconnect such a connection when the scene is destroyed. If the model outlived the scene, the signal called onNodeUpdated() on the deleted scene. Fixes #464
The test fails without the previous change: the model keeps a listener for inPortDataWasSet() after the scene is deleted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
DataFlowGraphicsSceneconnected a lambda toDataFlowGraphModel::inPortDataWasSetwithout a context object. Qt cannot disconnect such a connection when the scene is destroyed, because the connection has no receiver. If the model outlives the scene, the nextinPortDataWasSetcallsonNodeUpdated()on the deleted scene.The fix passes
thisas the context object, so Qt removes the connection when the scene is deleted. The lambda still capturesthisfor its body. Behavior of a living scene does not change: model and scene are in the same thread, so the call stays direct.I checked the other
connect()calls with a lambda and no context insrc/. They are not affected, because the sender is destroyed together with the receiver or with the widget that owns it.Commits, each builds and passes on its own:
Disconnect the scene from the model when the scene is deleted. One line.Test that a deleted DataFlowGraphicsScene is disconnected from the model. The test deletes the scene while the model stays alive and checks that no listener ofinPortDataWasSetis left. It fails without commit 1 (!true).Testing
Breaking changes?
No.
Related issue
Fixes #464